from django.conf import settings
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
class SecretOauth(object):
    def dumps(self, datas): #加密
        serializer = Serializer(secret_key=settings.SECRET_KEY, expires_in=24*15*60)
        result = serializer.dumps(datas) #加密
        return result
    def loads(self, secret_datas): #解密
        serializer = Serializer(secret_key=settings.SECRET_KEY, expires_in=24*15*60)
        result = serializer.loads(secret_datas)
        return result